﻿<Window x:Class="WpfBasicControlTemplate.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <LinearGradientBrush x:Key="brush1" StartPoint="0,0" EndPoint="1,1">
            <GradientStop Offset="0" Color="Beige"/>
            <GradientStop Offset="1" Color="Brown"/>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="brush2" StartPoint="0,0" EndPoint="1,1">
            <GradientStop Offset="0" Color="Gray"/>
            <GradientStop Offset="1" Color="Black"/>
        </LinearGradientBrush>
        <ControlTemplate x:Key="myButtonTemplate">
            <Grid>
                <Ellipse x:Name="myEllipse" Width="75" Height="50" Fill="{StaticResource brush1}" Opacity="10"></Ellipse>
                <Label VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16" FontWeight="Bold">Click Me</Label>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="Button.IsPressed" Value="true">
                    <Setter TargetName="myEllipse" Property="Fill" Value="{StaticResource brush2}"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </Window.Resources>
    <Grid>
        <Button Template="{StaticResource myButtonTemplate}" Click="Button_Click">Click Me</Button>
    </Grid>
</Window>
